# -*- coding: utf-8 -*-
'''
@author: Donny
@Created on: 2011-8-24
@version: 2011.8.24
@summary: unit test of ExcelOperator class
'''
import unittest
from util.exceloperator import ExcelOperator

class ExcelOperator_Test(unittest.TestCase):
    '''
    ExcelOperator method unit test.
    '''        
    def setUp(self):
        '''
        Set up test data.
        '''
        print 'excelOperator_test -- setUp '
        self.path = 'C:\\Documents and Settings\\wd\\Desktop\\testcase.xls'
        self.exl_opt = ExcelOperator(self.path)
    
    def tearDown(self):
        '''
        Tear down test.
        '''
        print 'excelOperator_test -- tearDown '
        self.exl_opt.close()
        self.exl_opt = None
              
    def test_get_case_id_list_by_priority(self):
        '''
        Test get_case_id_list_by_priority method.
        '''
        id_list = self.exl_opt.get_case_id_list_by_priority("All")
        print 'excelOperator_test -- test_get_case_id_list_by_priority: ' \
              'id_list = ' + str(id_list)
              
    def test_get_step_info_list(self):
        '''
        Test get_step_info_list method.
        '''
        id_list = self.exl_opt.get_case_id_list_by_priority("All")
        step_list = []
        for id in id_list:
            step_list.append(self.exl_opt.get_step_info_list(id))
        print 'excelOperator_test -- test_get_step_info_list: step_list = ' \
              + str(step_list)
              
    def test_get_case_list(self):
        '''
        Test get_case_list method.
        '''
        case_list = self.exl_opt.get_case_list("All")
        print 'excelOperator_test -- test_get_case_list: case_list = ' \
              + str(case_list)
        
        
if __name__ == "__main__":
#    unittest.main()
    suite = unittest.TestSuite()
    suite.addTest(ExcelOperator_Test("test_get_case_list"))
    unittest.TextTestRunner().run(suite)
